package information;

import java.util.Comparator;

/**
 * Comparator for comparing dates of two jobs.
 * Supports user story 7
 * @author Christian
 *
 */
public class JobDateComparator implements Comparator<Job> {
	/**
	 * Compares dates of two jobs. Does not compare as we would like.
	 * To compare as we would like, I should have padded the months and days, then compare them.
	 * i.e. will indicate that 4/3/2012 > 4/25/2012
	 */
	//@requires the jobs and dates not null and are properly populated
	//@ensures that one job is >, =, or < the other job based on dates
	public int compare(Job j1, Job j2) {
		String date1 = j1.getStartDate().toString();
		String date2 = j2.getEndDate().toString();
		return date1.compareTo(date2);
	}
}
